const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const { common } =  require('./webpack.config');
const rendererConfig = {
    ...common, 
    target: 'electron-renderer',
    entry: {
        renderer: './src/renderer/index.ts',
    },
    output: {
        filename: '[name].js',
        path: path.join(__dirname, '../dist/renderer')
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: 'test',
            template: './src/renderer/index.html'
        }),
        new webpack.HotModuleReplacementPlugin(), // 热更新模块
        new webpack.NoEmitOnErrorsPlugin()
    ],
    node: {
        __dirname: process.env.NODE_ENV !== 'production',
        __filename: process.env.NODE_ENV !== 'production'
      },
}

module.exports = {
    rendererConfig
}